window.onload = function () {
    const ua = navigator.userAgent.toLowerCase().toString();
    console.info(ua, 'navigator.userAgent');
    let isMacOS = (ua.indexOf("iphone") > -1 || ua.indexOf("ipod") > -1 || ua.indexOf("ipad") > -1);
    if (isMacOS) {
        document.getElementById("ios-des").style.display = 'block';
    } else {
        document.getElementById("ios-des").style.display = 'none';
        // window.location.href = 'http://a.app.qq.com/o/simple.jsp?pkgname=com.tykj.housekeeping';
    }
};

/**
 * 点击下载安装执行
 */
function appDownload() {
    const ua = navigator.userAgent.toLowerCase().toString();

    let isMacOS = ua.indexOf("iphone") > -1;
    if (isMacOS) {
        iosDownload();
        return;
    }

    // Android 需要判断是不是微信 MicroMessenger
    let isWeChat = ua.match('micromessenger');
    if (isWeChat) {
        let weChatDiv = document.getElementById('wechat-mask');
        weChatDiv.style.height = window.innerHeight + 'px';
        weChatDiv.style.display = 'block';
        return;
    }

    window.location.href = 'https://pro-onecash-bucket.oss-cn-beijing.aliyuncs.com/ipa/laijinjia.apk';
}

/**
 * iOS下载专用
 */
function iosDownload() {
    window.location.href = 'itms-services://?action=download-manifest&url=https://pro-onecash-bucket.oss-cn-beijing.aliyuncs.com/ipa/laijinjia.plist';
    setTimeout(function () {
        document.getElementById("ios-prompt").innerHTML = "<p style='color: #4CAF50;font-size: 26px; font'>" + "正在安装，请按 Home 键在桌面查看" + "</p>";
    }, 1800);
}